<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script>
 $(function () {
     autoCompleteClinic("itemName");
     //1 如果选择
    $("#btnCancel").on('click', function () {
        hideShowTableTd('contentTable', '0,1,2,3,4,5,6,7,8,9,10,11,12,13,14', '1');
        $("#RightDiv").attr("style", "display: none");
        $("#LeftDiv").attr("class", "main-content col-lg-12");
        $("#LeftDiv").show('normal');
    })
})

/**
  药品和诊疗项目*
* @param inputId
 */
function autoCompleteClinic(inputId) {
    var url = "${ctx}/orders/orders/automaticClinic";
    autoComplete(inputId, url,
            function (data) {
                var rows = [];
                for (var i = 0; i < data.length; i++) {
                    rows[rows.length] = {
                        data: data[i],
                        value: data[i].id,
                        result: data[i].item_name
                    };
                }
                return rows;
            }, function (data, i, max) {
                return "类别："+data.itemclasslabel+"|项目：" + data.item_name + "|价格：" + data.price+"元|规格：" + data.item_spec+"|单位：" + data.unitslabel;
            }, function (event, data, formatted) {
                $("#priceId").val(data.id);
                $("#itemClass").val(data.item_class);
                $("#itemSpec").val(data.item_spec);
                $("#itemPrice").val(data.price);
                $("#itemCode").val(data.item_code);
                $("#units").val(data.unitsLabel);
                $("#unitsHidden").val(data.units);
                $("#classOnMr").val(data.class_on_mr);
                $("#subjCode").val(data.subj_code);
                $("#classOnReckoning").val(data.class_on_reckoning);
            })
}







</script>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="col-lg-12">
                    <form:form id="inputForm" data-parsley-validate="" modelAttribute="inpBillDetail" method="post"
                               class="form-horizontal"
                               onsubmit="return formSaveLoad('mainCenterDiv','inputForm','${ctx}/orders/orders/nurseOperFee','${ctx}/orders/orders/feeOper?patientId='+$('#patientId').val()+'&visitId='+$('#visitId').val());">
                        <form:hidden path="patientId"/>
                        <form:hidden path="visitId"/>
                        <form:hidden path="priceId"/>
                        <form:hidden path="itemClass"/>
                        <form:hidden path="costs"/>
                        <form:hidden path="priceQuotiety" value="1"/>
                        <form:hidden path="charges"/>
                        <form:hidden path="classOnMr"/>
                        <form:hidden path="subjCode"/>
                        <form:hidden path="units" id="unitsHidden"/>
                        <form:hidden path="classOnReckoning"/>
                        <form:hidden path="deptStayed"/>
                        <form:hidden path="wardCode"/>
                        <form:hidden path="itemCode"/>
                        <form:hidden path="storageId"/>
                         <div class="form-group">
                            <div class="col-sm-12">
                                <form:select itemLabel="label" itemValue="value" path="type"  class="form-control" data-parsley-required="true">
                                  <%--  <form:option value="" label="请选择操作类型"/>--%>
                                    <form:option value="0" label="录入费用"/>
                                <%--    <form:option value="1" label="退费"/>--%>
                                 </form:select>
                            </div>
                        </div>

                         <div class="form-group">
                              <div class="col-sm-12">
                                <form:input path="itemName" id="itemName" htmlEscape="false" class="form-control" maxlength="32"
                                            data-parsley-required="true" placeholder="请搜索要补录的项目"/>
                             </div>
                        </div>
                         <div class="form-group">
                             <div class="col-sm-12">
                                <form:input id="units" path="" htmlEscape="false" disabled="true" class="form-control"
                                            maxlength="20" placeholder="单位"/>
                            </div>
                        </div>
                        <div class="form-group">

                            <div class="col-sm-12">
                                <form:input path="itemSpec" htmlEscape="false" disabled="true" class="form-control"
                                            maxlength="20" placeholder="项目规格"/>
                            </div>
                        </div>
                        <div class="form-group">

                            <div class="col-sm-12">
                                <form:input path="itemPrice" htmlEscape="false" disabled="true" class="form-control"
                                            maxlength="20" placeholder="单价"/>
                            </div>
                        </div>
                        <div class="form-group">
                             <div class="col-sm-12">
                                <div class="spinner input-group mb15">
                                    <input type="number" name="amount" min='1' id="amount"
                                           class="form-control input-sm spinner-input" placeholder="请输入数量" data-parsley-required="true" >
                                </div>
                            </div>
                        </div>
                        <div class="form-group">

                            <div class="col-sm-12">
                                <sys:treeselect id="orgDept" selectedParent="" name="orderDept" isnull="true"
                                                value="${orgDept.id}" update="${not empty orgDept.id}"
                                                labelName="${orgDept.deptName}" labelValue="${orgDept.id}"
                                                title="选择开单科室" url="/sys/orgDept/treeData"
                                                cssClass="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-12">
                                <form:select path="orderDoctor" id="orderDoctor" class="form-control" itemLabel="freqDesc" itemValue="id" data-parsley-required="true" >
                                    <form:option value="" label="请选择开单医生"/>
                                    <form:options items="${fns:getOrgStaffList()}" itemLabel="name" itemValue="staffId"
                                                  htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="form-group">
                                <%--<label class="col-sm-4 control-label">途径：</label>--%>

                            <div class="col-sm-12">
                                <sys:treeselect id="orgDept1" selectedParent="" name="performDept" isnull="true"
                                                value="${orgDept1.id}" update="${not empty orgDept1.id}"
                                                labelName="${orgDept1.deptName}" labelValue="${orgDept1.id}"
                                                title="选择执行科室" url="/sys/orgDept/treeData"
                                                extId="${orgDept1.id}" cssClass="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                                <%--<label class="col-sm-4 control-label">频次：</label>--%>
                            <div class="col-sm-12">
                                <form:select path="performPerson" id="performDoctor" class="form-control" itemLabel="freqDesc" itemValue="id" data-parsley-required="true" >
                                    <form:option value="" label="请选择执行医生"/>
                                    <form:options items="${fns:getOrgStaffList()}" itemLabel="name" itemValue="staffId"
                                                  htmlEscape="false"/>
                                </form:select>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <input id="btnSubmit" class="btn btn-primary" type="submit" value="保存">&nbsp;
                                <input id="btnCancel" class="btn" type="button" value="关 闭"></div>
                        </div>
                    </form:form>
                </div>
            </div>
        </section>
    </div>
</div>

